#ifndef CONTENT_HANDLER_HH
# define CONTENT_HANDLER_HH

#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>

#include "display/mesh.hh"
#include "display/texture.hh"

#include <utility>

class ContentHandler
{
public:
  static ContentHandler* get (const std::string& transpath = std::string (""));

  //create a mesh stored as m[id] = boost::shared_ptr<Mesh> (new Mesh(filename))
  void instantiate_mesh (int id, const std::string& filename);

  //same for texture
  void instantiate_texture (const std::string& id, const std::string& filename);

  //retreive m[id], return a new shared_ptr so increase ref cpt by 1
  boost::shared_ptr<Mesh> mesh (int id, Bounding* bounding, const Vector3f& pos, const Vector3d& rotate);
  boost::shared_ptr<Texture> texture (const std::string& id);

protected:
  ContentHandler (const std::string& transpath);

  boost::unordered_map<int, boost::shared_ptr<Mesh> > meshm_;
  boost::unordered_map<std::string, boost::shared_ptr<Texture> > texm_;

  static ContentHandler* ch;
};

#endif /// !CONTENT_HANDLER_HH
